package com.welyo.model {
	/**
	 * ...
	 * @author vu.doan
	 */
	public class Model {
		
		private static var instance			:Model;
		
		private var arrSubMenu				:Array;
		private var arrMenu					:Array;
		private var linkLogo				:String;
		
		public function Model() {
			if (Model.instance) {
				throw new Error('Use Model.getInstance() method instead');
			}
			Model.instance = this;
			arrMenu = [];
			arrSubMenu = [];
		}
		
		public static function getIntance():Model {
			if (!Model.instance) {
				Model.instance = new Model();
			}
			
			return instance;
		}
		
		public function parseData(data:XML):void {
			var sub:SubMenuItemVO;
			for (var i:int = 0; i < data.subitem.item.length(); i++) {
				sub = new SubMenuItemVO(new XML(data.subitem.item[i].toString()));
				arrSubMenu.push(sub);
			}
			
			for (i = 0; i < data.menu.item.length(); i++) {
				arrMenu.push(data.menu.item[i].toString());
			}
			
			linkLogo = data.linklogo.toString();
		}
		
		public function get SubMenus():Array {
			return arrSubMenu;
		}
		
		public function get Menus():Array {
			return arrMenu;
		}
		
		public function get LinkLogo():String {
			return linkLogo;
		}
	}
}